Use Templates
Previous  Top  Next



A template is a special kind of document that provides content for shaping a new document. You can use several templates to save time in creating many common types of documents.

Templates are slightly different from normal documents in that their first line contains the template header definition. The header informs NoteTab that the file being opened is a template; it can also tell NoteTab what name it should generate for the new document. For example, the default header looks like this:

= DocTemplate "Notes%0.3d.txt"

Use the menu command " File | Template | New" to create a new template. You can also convert your current document to a template by inserting a template header with the menu command " File | Template | Add Header". When you save such a template, make sure you give it the extension .tpl.

Headers must always start with an equal (=) sign as the first character on the line followed by the word "DocTemplate" (case is not important). After that first part, you can add the text format that NoteTab should use to generate the names of documents based on the template. This information is optional and must be enclosed in double quotes (") when used. The code "%d" indicates where the incremental numbering is inserted in the name. In the above example, the "0.3" between the % and d tells NoteTab to format numbers smaller than 3 digits with leading zeroes. If you omit the extension, the currently defined default extension will be added when the name is generated. You can also include a path name if you always want the documents saved in the specified directory.

Add this type of header on the first line of any document and it will become a template once you save it. Then, whenever you open it through the "File | Open" or "File | Template | Open" menu command, a new document based on your template will be created. If you need to modify the content of a template, use the "File | Template | Edit" menu command.

Starting with version 4.6, NoteTab template files accept Clip commands and functions embedded in the text. When such a file is opened, the text contained in it is interpreted and the resulting text is displayed in the document. To enable this feature, you will have to include the keyword "ClipCode" in the header line of the template file. See the template file HTML.tpl for an example of embedded functions. Example of header:

= DocTemplate
ClipCode "Home%0.3d.htm"

Note that you cannot close a template document through its own embedded Clip code.

Since version 4.8, template headers accept the ^$GetDate()$ function in order to use the current date in the file name. Example:
= DocTemplate ClipCode "Notes-^$GetDate(yyyymmdd)$-%0.3d.txt"


Since version 4.82, template headers can use Clip directory functions to represent special path names (e.g. ^$GetScriptPath$, ^$GetTmpPath$). Example taken from FTP.tpl:
= DocTemplate ClipCode "^$GetScriptPath$FTP%0.3d.scr"